<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Repeating element</title>
    <style>
        @page {
            size: 820px;
        }
        @-epubx-page-template {
            .partition {
                width: 398px;
                height: 198px;
                border: rgba(0, 0, 255, 0.2) solid 1px;
                -epubx-flow-from: body;
            }
            .left {
                left: 10px;
            }
            .right {
                right: 10px;
            }

            @-epubx-page-master {
                @-epubx-partition {
                    bottom: 0;
                    left: 0;
                    right: 0;
                    height: 10px;
                    font-size: 10px;
                    line-height: 10px;
                    text-align: center;
                    content: counter(page);
                }
                @-epubx-partition class(partition) class(right) {
                    top: 610px;
                }
                @-epubx-partition class(partition) class(right) {
                    top: 410px;
                }
                @-epubx-partition class(partition) class(right) {
                    top: 210px;
                }
                @-epubx-partition class(partition) class(right) {
                    top: 10px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 610px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 410px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 210px;
                }
                @-epubx-partition class(partition) class(left) {
                    top: 10px;
                }
            }
        }
        :root {
            font-size: 10px;
            line-height: 12px;
            widows: 1;
            orphans: 1;
        }
        body {
            margin: 0 10px;
        }
        section {
            break-after: column;
        }
        h1 {
          font-size: 10px;
          font-weight: normal;
        }

        .header {
            repeat-on-break: header;
            background-color: #FF9999 !important;
        }
        .footer {
            repeat-on-break: footer;
            background-color: #9999FF !important;
        }

        .auto {
            repeat-on-break: auto;
        }
        .thead {
            display: table-header-group;
        }
        .tfoot {
            display: table-footer-group;
        }

        .box {
            height: 30px;
            border: 1px solid #999;
            margin: 2px;
            padding: 2px;
        }
        .child {
            padding: 10px;
            margin: 2px;
            border: 1px solid #999;
            background-color: #ddd;
        }
        .child .box {
            background-color: #FFF;
            height: 20px;
        }
    </style>
</head>
<body>

    <section>
        <h1>(1) Nested headers/footers</h1>
        <div>
            <div class="box header">this is header of parent</div>
            <div class="box footer">this is footer of parent</div>
            <div class="box1 box">parent content 1</div>
            <div class="box2 box">parent content 2</div>
            <div class="box3 box">parent content 3</div>
            <div class="child">
                <div class="c1 box">child1 content 1</div>
                <div class="box header">this is header of child1</div>
                <div class="box footer">this is footer of child1</div>
                <div class="c2 box">child1 content 2</div>
                <div class="c3 box">child1 content 3</div>
            </div>
            <div class="box4 box">parent content 4</div>
            <div class="child">
                <div class="c21 box">child2 content 1</div>
                <div class="c22 box">child2 content 2</div>
                <div class="c23 box">child2 content 3</div>
                <div class="box header">this is header of child2</div>
                <div class="box footer">this is footer of child2</div>
            </div>
            <div class="box5 box">parent content 5</div>
            <div class="box6 box">parent content 6</div>
        </div>
    </section>


    <section>
        <h1>(2) break at the last child</h1>
        <div>
            <div class="box header">this is header of parent</div>
            <div class="box footer">this is footer of parent</div>
            <div class="child">
                <div class="c1 box">child1 content 1</div>
                <div class="box header">this is header of child1</div>
                <div class="box footer">this is footer of child1</div>
                <div class="c2 box">child1 content 2</div>
                <div class="c3 box">child1 content 3</div>
            </div>
            <div class="p1 box">parent content 1</div>
        </div>
    </section>

    <section>
        <h1>(3) break at the text box</h1>
        <div>
            <div class="box header">this is header of parent</div>
            <div class="box footer">this is footer of parent</div>
            <div>
              text1<br/>
              text2<br/>
              text3<br/>
              text4<br/>
              text5<br/>
              text6<br/>
              text7<br/>
              text8<br/>
              text9<br/>
              text10<br/>
              text11
            </div>
            <div class="child">
                <div class="box header">this is header of child1</div>
                <div class="box footer">this is footer of child1</div>
                <div>
                  text1<br/>
                  text2<br/>
                  text3<br/>
                  text4<br/>
                  text5<br/>
                  text6<br/>
                  text7
              </div>
            </div>
            text12<br/>
            text13<br/>
            text14<br/>
            text15<br/>
            text16<br/>
            text17<br/>
        </div>
    </section>

    <section>
        <h1>(4) drop in order from the footer of the child element</h1>
        <div class="parent">
            <div class="box header" style="height:50px">this is header of parent</div>
            <div class="box footer" style="height:50px">this is footer of parent</div>

            <div class="child c1">
                <div class="box header" style="height:40px">this is header of child1</div>
                <div class="box footer">this is footer of child1</div>
                <div class="box c11">child1 content 1 / drop parent footer</div>
            </div>

            <div class="child c2">
                <div class="box header" style="height:40px">this is header of child2</div>
                <div class="box footer" >this is footer of child2</div>
                <div class="box c21">child2 content 1 / drop child footer and parent footer</div>
                <div class="box c22">child2 content 2 / drop child header</div>
            </div>

            <div class="child c3">
                <div class="box header" style="height:50px">this is header of child3</div>
                <div class="box footer" style="height:50px">this is footer of child3</div>
                <div class="box c31" style="height:190px">drop child footer, and parent header, footer.</div>
                <div class="box c32" style="height: 50px">drop child header and footer</div>
                <div class="box c33" style="height:120px">drop child header and footer, and parent footer</div>
                <div class="box c34" style="height:190px">drop child header and footer, and parent header, footer</div>
                <div class="box c35" style="height:160px">drop child header, and parent header, footer.</div>
            </div>

        </div>
    </section>

</body>
</html>
